Skip to content

docs(coding): add the time and dates rule - #371

Merged
daniel-kindl merged 5 commits into
mainfrom
docs/366-time-dates
Nov 25, 2026
Merged

daniel-kindl merged 5 commits into
mainfrom
docs/366-time-dates

Conversation

@daniel-kindl

Copy link
Copy Markdown
Owner

Closes #366

Summary

coding/time.md is the owner page for time and dates in production code. Before, only tdd/deterministic-tests.md covered time, for tests.

  • Store and send an instant in UTC as RFC 3339 text.
  • Convert to local time only to show it.
  • Store a future civil time with its IANA time zone ID, for example Europe/Prague.
  • Domain code gets a clock (TimeProvider, java.time.Clock or a function).
  • Measure a duration with a monotonic clock.
  • Use the platform library for calendar arithmetic. Do not add 86400 for one day.

The examples use the night of the daylight saving change in Prague, 2027-03-28.

Evidence

  • Verified: test/time.test.mjs came first and failed on all three tests. It pins the key phrases, the examples and the index link. 2027-03-28 is the last Sunday of March 2027, the EU start of daylight saving time. npm run check passes. check:title and check-breaking pass.
  • Unverified: none.
  • Known risk: the example assumes that the EU keeps daylight saving time in 2027.
  • NOT RUN: actionlint, which runs only in validate.
  • Observability: none, docs only.

Risk and rollback

Low. A new page (MINOR). Revert the commit to roll back.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Review of PR #371

Verdict: CHANGES-REQUESTED
Reviewed head: 8e5b520
Reviewer: independent subagent. I did not write this change. I did the three axes myself in order, with no subagents.

Summary

  • Standards: 2 findings (worst: Low).
  • Specification: 0 findings. All 7 acceptance criteria are met.
  • Blast radius: docs only, no consumer break.

Standards

  • L1, coding/time.md:36-40, Low. The bad example says "The reminder comes one hour late". The stored value 2027-03-28T09:00+01:00 is the instant 08:00 UTC, which is 10:00 in Prague after the change. The harm is that the meeting shows one hour late (10:00), and the reminder for the 09:00 meeting fires one hour after the intended time. The text does not say which instant is wrong. Rule: writing/index.md, one clear meaning per sentence. Fix: write "The stored instant is 08:00 UTC, which is 10:00 in Prague. The reminder comes one hour late."
  • L2, skills/triage/SKILL.md:55, Low. Triage routes a bug to coding/debugging.md but has no route for a task that touches time or dates, so an agent that follows triage will not find the new page. coding/index.md lists it, which meets the issue, but the page is only found by browsing. Rule: skills/triage/SKILL.md. Fix: add a triage line for time and dates, or open a follow-up issue. This is outside the acceptance criteria, so a follow-up issue is acceptable.

Specification

No findings. Quote of each criterion and where it is met:

  • "store and send an instant in UTC in RFC 3339 format with an offset. Convert to local time only to show it": coding/time.md:11-16. Met.
  • "keeps its IANA time zone ID, not only an offset": coding/time.md:17-20. Met.
  • "Domain code does not read the system clock. It gets a clock": coding/time.md:21-23. Met.
  • "Use a monotonic clock to measure a duration": coding/time.md:24-26. Met.
  • "Use the date and time library of the platform. Do not compute dates by hand": coding/time.md:27-29. Met.
  • "A good and a bad example": coding/time.md:31-40. Met.
  • "coding/index.md lists the page. A test pins the key phrases. One CHANGELOG line": all three present (coding/index.md:17, test/time.test.mjs, CHANGELOG.md:33). Met.

Blast radius

  • Safety fact: the change adds one new Markdown page, one index line, one test file and one CHANGELOG line. No script, workflow or existing rule changes. Level 4, Run: npm run check passes on Node v24.19.0 (Linux). The links in the page resolve (ui/content-and-localization.md, architecture/configuration.md and tdd/deterministic-tests.md exist).
  • Confirmed risks: none.
  • Cleared: no consumer must act (a new page, MINOR). No overlap with tdd/deterministic-tests.md, which says "inject a clock or freeze time" for tests only, so the new page does not contradict it.

Tests

  • The three tests pin the key phrases, both example headings and the index link.
  • Mutations I tried on a throwaway checkout:
    • RFC 3339 to RFC 3999: test fails. Good.
    • IANA time zone to zone: test fails. Good.
    • 86400 to 86401: test fails. Good.
    • ## Bad example to ## Bad: test fails. Good.
    • (time.md) to (timex.md) in the index: test fails. Good.
    • "Do not read the system clock in domain code" inverted to "Read the system clock in domain code": all tests still pass. The test pins words, not meaning.
  • The inverted-rule result is expected for a keyword test on a docs page, so I do not raise it as a finding. The author could pin the sentence Do not read the system clock in domain code to close the gap, but this is optional.

Verification

  • Daylight saving date: 2027-03-28 is a Sunday and the last Sunday of March 2027 (cal 3 2027). The EU change is on that day, from +01:00 to +02:00. Level 4, Run, for the calendar. The EU rule itself (last Sunday of March) is level 2, Documented. The PR body states this as a known risk.
  • API names: TimeProvider (.NET 8), java.time.Clock, performance.now(), time.monotonic() and Stopwatch (.NET) are the names I know from the platform docs. Level 2, Documented, from memory of the docs. NOT RUN: I did not open the vendor docs.
  • Local run: npm run check passes on the head in /tmp/rev-371, Node v24.19.0, Linux. Level 4, Run, for Linux only.
  • Required check validate: pass on the head.
  • PR text: the title is a conventional commit, the body has Closes #366, an Evidence section and an Observability line. NOT RUN is named for actionlint.
  • node scripts/check-review.mjs: run before posting, see the result in the report to the requester.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Response to the review at 8e5b520.

  • L1, bad example ambiguous: fixed in the new head. The example now states 08:00 UTC, 09:00 in Prague and 07:00 UTC.
  • L2, no triage route: not changed. The triage "Code changes" row routes to coding/index.md, which lists time.md (the index link is pinned by test/time.test.mjs). The other coding pages have no separate triage row either. Evidence: skills/triage/SKILL.md, section map, row "Code changes". The next review decides.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Re-review of PR #371

Verdict: APPROVE-RECOMMENDED
Reviewed head: ae92239
Reviewer: independent subagent. Earlier review was at 8e5b520.

Earlier findings

  • L1, bad example ambiguous: fixed. coding/time.md:38-41 now says 09:00+01:00 is 08:00 UTC, the user meant 09:00 in Prague, and that is 07:00 UTC after the change at 02:00. The arithmetic is right: Prague is +02:00 on 2027-03-28 after the change, so 09:00 local is 07:00 UTC, and the stored value is one hour late.
  • L2, no triage route: fixed (answered with evidence). skills/triage/SKILL.md:89 has the row "Code changes", which links coding/index.md. That index lists time.md (coding/index.md:17), and test/time.test.mjs pins the index link. Other coding pages, for example dependencies.md, have no own triage row either. The answer is accepted and no follow-up is needed.

Delta

  • The delta since 8e5b520 is the L1 edit in coding/time.md plus the merge of main (.gitignore, CHANGELOG.md, test/gitignore.test.mjs). The merged files are not part of this change. The new CHANGELOG line for docs(coding): add the time and dates rule #366 is still one line. No new finding on the touched code.

Verification

  • npm run check on a throwaway checkout of the head: exit 0, 1004 tests, 1004 pass, 0 fail (Node v24.19.0, Linux). Level 4, Run, for Linux only.
  • Required check validate: pass on the head.
  • node scripts/check-review.mjs: run on this file before posting.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Re-review of PR #371 (merge of main)

Verdict: APPROVE-RECOMMENDED
Reviewed head: 7383335
Earlier approval was at ae92239. No open finding (L1 and L2 stay fixed).

Delta

Verification

  • Required check validate: success on the head. GitHub shows the PR as mergeable and clean.
  • check-review.mjs: run on this file before posting.

@daniel-kindl
daniel-kindl merged commit 8bd933d into main Nov 25, 2026
1 check passed
@daniel-kindl
daniel-kindl deleted the docs/366-time-dates branch November 25, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(coding): add the time and dates rule

1 participant